--[[
    有玩家下注时表现动画
    点击弹出房间内玩家列表PlayerListUI
]]--

local blaze = require "blaze"
local app = require "app"
local game = app.game.running

local M = game.ui.element()

M.store_watchers = {
    gameplay = {
        ["$"] = blaze.noop,

        ["玩家下注"] = function(self, store, state, args)
            local player = args.player
            if not self.seats:find(player) then
                self.animator:Play("others_bet_clip")
            end
        end
    }    
}

function M:ctor(seats)
   self.res = "club.threecard.baccaratlib/ui/common.b:others"
   self.seats = seats
   self.playerlist = nil
end

function M:on_injected(bind)
    bind("button.click", self.btn_self, self.on_click)
    game.utility.button_style.highlight_scale(self.btn_self)
end

function M:on_click()
    if not self.playerlist then
        local PlayerList = require "club.threecard.baccaratlib.ui.playerlist.PlayerListUI"
        self.playerlist = PlayerList.new()
        self.playerlist:set_layer(app.config.ui.layout.popup.layer - 5)
        self.playerlist:load()
    end
    self.playerlist:show()
end

return M